﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="UserList.ascx.cs" Inherits="admin_webparts_Plug_ins_User2_UserList" %>
<%@ Import Namespace="NTTHAO.Web.BL.Authentication" %>
<div class="tip" style="margin-bottom: 3px;">
    <h2 style="left: 0px; position: relative; padding-top: 0px;"><%=_Title %></h2>
</div>
<%
if (_SearchResult != null) 
{
      %>
<table border="1" cellpadding="0" cellspacing="0" class="grid">
    <tr>
        <th>STT</th>
        <th>Tên</th>
        <th>Tên đăng nhập</th>
        <th>Email</th>
        <th>Ngày đăng ký</th>
        <th>Tình trạng</th>
        <th style="white-space: nowrap; width: 1px;">Chức năng</th>
    </tr>
<%
    if (_SearchResult != null)
    {
        int index = 0;
        foreach (System.Data.DataRow row in _SearchResult.Rows)
        {
            int id = (int)row[User.ID__COLUMN_NAME];
            int title = (int)row[User.USERTITLE__COLUMN_NAME];
            string fullName = row[User.FULLNAME__COLUMN_NAME].ToString();
            string username = (string)row[User.USERNAME__COLUMN_NAME];
            string email = (string)row[User.EMAIL__COLUMN_NAME];
            DateTime joinDate = (DateTime)row[User.JOINDATE__COLUMN_NAME];
            int statusID = (int)row[User.STATUSID__COLUMN_NAME];
            string userTitle = UserTitle.GetTitle(title);
            if (userTitle == string.Empty)
            {
                userTitle = "-";
            }
            index++;
        %>
    <tr class="<%=index % 2 == 0 ? "even" : "odd"%>">
        <td class="center"><%=index %></td>
        <td><%= "(" + userTitle + ") " + fullName%></td>
        <td class="center"><%=username%></td>
        <td><a href="mailto:<%=email %>"><%=email%></a></td>
        <td class="center"><%=joinDate.ToString("HH:mm dd/MM/yyyy") %></td>
        <td class="center"><%=UserStatus.GetStatusName(statusID) %></td>
        <td>
            <ul class="icon" style="width: 84px;">
                <li><a class="icon detailbtn" title="Chi tiết" href="?type=page&name=user&action=detail&user=<%=email%>">&nbsp;</a></li>
<%if (statusID == UserStatus.INACTIVE || statusID == UserStatus.ACTIVATED)
  { %>
                <li><a class="icon inactivebn" title="Khóa tài khoản" href="?type=page&name=user&action=deactive&user=<%=email%>">&nbsp;</a></li>
<%} %>
            </ul>
        </td>
    </tr>
<%
        }
    }
%>
</table>
<%
} else {
%>
<div style="border: solid 1px #89F;font-weight: bold; padding: 5px;margin-bottom: 3px;">Không tìm thấy người dùng nào.</div>
<%
}
%>

